package pdn.sci.cs.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

import org.hibernate.annotations.GenericGenerator;

@Entity
@Table(name = "child_sponsor", uniqueConstraints = @UniqueConstraint(columnNames = {
		"CHILD_ID", "SPONSOR_ID" }))
@GenericGenerator(name = "uuid-strategy", strategy = "uuid.hex")
public class ChildSponsor extends BaseEntity implements java.io.Serializable {

	private static final long serialVersionUID = 1L;
	public static final String CHILD_ID = "child.id";
	public static final String SPONSER_ID = "systemUser.id";
	private String id;
	private SystemUser systemUser;
	private Child child;

	public ChildSponsor() {
	}

	public ChildSponsor(String id, SystemUser systemUser, Child child) {
		this.id = id;
		this.systemUser = systemUser;
		this.child = child;
	}

	public ChildSponsor(SystemUser systemUser, Child child) {
		this.systemUser = systemUser;
		this.child = child;
	}

	@Id
	@Column(name = "ID", unique = true, nullable = false, length = 32)
	@GeneratedValue(generator = "uuid-strategy")
	public String getId() {
		return this.id;
	}

	public void setId(String id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "SPONSOR_ID", nullable = false)
	public SystemUser getSystemUser() {
		return this.systemUser;
	}

	public void setSystemUser(SystemUser systemUser) {
		this.systemUser = systemUser;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "CHILD_ID", nullable = false)
	public Child getChild() {
		return this.child;
	}

	public void setChild(Child child) {
		this.child = child;
	}

}
